<?php

namespace App\Http\Controllers\Home;

use App\Models\Appointment;
use App\Jobs\PayOrder;

class AppointmentController extends BaseController
{

    public function __construct(Appointment $appointment)
    {
        parent::__construct();
        $this->appointment = $appointment;
    }

    public function postAppointmentInfo()
    {
        $res = $this->appointment->addAppPointmentStep1(request());
        return ajax_return($res);
    }

    public function getAppointmentInfo()
    {
        $res = $this->appointment->addAppPointmentStep2(request());
        return ajax_return($res);
    }

    public function postAddAppointmentInfo()
    {
        $res = $this->appointment->addAppPointmentStep3(request());
        return ajax_return($res);
    }

    /**
     * 检测是否预约
     */
    public function getCheckHasApp(){
           $res = $this->appointment->checkHasApp(request());
           return ajax_return($res);
    }


    public function getCheckMemberCard()
    {
        $res = $this->appointment->checkMemberCard(request());
        return ajax_return($res);
    }

    public function getConfimPay()
    {
        $res = $this->appointment->getConfimPay(request());
        return ajax_return($res);
    }

    public function getChangeExpire(){
         $res =  $this->appointment->getChangeState(array('a_id'=>request('aid'),'state'=>5),'操作成功');
         return ajax_return($res);
    }

    public function getAppointmentList()
    {
        $res = $this->appointment->getAppointmentList(request());
        return ajax_return($res);
    }

    public function getCheckInDayBySection(){
          $res = $this->appointment->checkInDayBySection(request());
          return ajax_return($res);
    }

    public function getChangeTime()
    {
        $res = $this->appointment->getChangeTimes(request());
        return ajax_return($res);
    }


    public function postChangeTime()
    {
        $res = $this->appointment->postChangeTimes(request());
        return ajax_return($res);
    }

    /**
     *  删除预约单
     */
    public function postDelAppointDel()
    {
        $res = $this->appointment->delOrder(request('id'));
        return ajax_return($res);
    }


}
